package com.baofengtv.wake;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyReceiver extends BroadcastReceiver {
    public MyReceiver() {
    }

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        String action = intent.getAction();
        if(action.equals(Intent.ACTION_TIME_TICK)){
            SimpleDateFormat formatter   =   new   SimpleDateFormat   ("HH");

            Date curDate =  new Date(System.currentTimeMillis());
            String ver = formatter.format(curDate);
            Log.d("czx",ver);
            if (ver.equals("10")||ver.equals("11")||ver.equals("19")){
                Intent intent1 = new Intent();

                context.startService(intent1);
            }

        }

    }
}
